# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AlertCenter.V1beta1.Model.RuleViolationInfo do
  @moduledoc """
  Common alert information about violated rules that are configured by Google Workspace administrators.

  ## Attributes

  *   `dataSource` (*type:* `String.t`, *default:* `nil`) - Source of the data.
  *   `eventType` (*type:* `String.t`, *default:* `nil`) - Event associated with this alert after applying the rule.
  *   `matchInfo` (*type:* `list(GoogleApi.AlertCenter.V1beta1.Model.MatchInfo.t)`, *default:* `nil`) - List of matches that were found in the resource content.
  *   `recipients` (*type:* `list(String.t)`, *default:* `nil`) - Resource recipients. For Drive, they are grantees that the Drive file was shared with at the time of rule triggering. Valid values include user emails, group emails, domains, or 'anyone' if the file was publicly accessible. If the file was private the recipients list will be empty. For Gmail, they are emails of the users or groups that the Gmail message was sent to.
  *   `resourceInfo` (*type:* `GoogleApi.AlertCenter.V1beta1.Model.ResourceInfo.t`, *default:* `nil`) - Details of the resource which violated the rule.
  *   `ruleInfo` (*type:* `GoogleApi.AlertCenter.V1beta1.Model.RuleInfo.t`, *default:* `nil`) - Details of the violated rule.
  *   `suppressedActionTypes` (*type:* `list(String.t)`, *default:* `nil`) - Actions suppressed due to other actions with higher priority.
  *   `trigger` (*type:* `String.t`, *default:* `nil`) - Trigger of the rule.
  *   `triggeredActionInfo` (*type:* `list(GoogleApi.AlertCenter.V1beta1.Model.ActionInfo.t)`, *default:* `nil`) - Metadata related to the triggered actions.
  *   `triggeredActionTypes` (*type:* `list(String.t)`, *default:* `nil`) - Actions applied as a consequence of the rule being triggered.
  *   `triggeringUserEmail` (*type:* `String.t`, *default:* `nil`) - Email of the user who caused the violation. Value could be empty if not applicable, for example, a violation found by drive continuous scan.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :dataSource => String.t() | nil,
          :eventType => String.t() | nil,
          :matchInfo => list(GoogleApi.AlertCenter.V1beta1.Model.MatchInfo.t()) | nil,
          :recipients => list(String.t()) | nil,
          :resourceInfo => GoogleApi.AlertCenter.V1beta1.Model.ResourceInfo.t() | nil,
          :ruleInfo => GoogleApi.AlertCenter.V1beta1.Model.RuleInfo.t() | nil,
          :suppressedActionTypes => list(String.t()) | nil,
          :trigger => String.t() | nil,
          :triggeredActionInfo => list(GoogleApi.AlertCenter.V1beta1.Model.ActionInfo.t()) | nil,
          :triggeredActionTypes => list(String.t()) | nil,
          :triggeringUserEmail => String.t() | nil
        }

  field(:dataSource)
  field(:eventType)
  field(:matchInfo, as: GoogleApi.AlertCenter.V1beta1.Model.MatchInfo, type: :list)
  field(:recipients, type: :list)
  field(:resourceInfo, as: GoogleApi.AlertCenter.V1beta1.Model.ResourceInfo)
  field(:ruleInfo, as: GoogleApi.AlertCenter.V1beta1.Model.RuleInfo)
  field(:suppressedActionTypes, type: :list)
  field(:trigger)
  field(:triggeredActionInfo, as: GoogleApi.AlertCenter.V1beta1.Model.ActionInfo, type: :list)
  field(:triggeredActionTypes, type: :list)
  field(:triggeringUserEmail)
end

defimpl Poison.Decoder, for: GoogleApi.AlertCenter.V1beta1.Model.RuleViolationInfo do
  def decode(value, options) do
    GoogleApi.AlertCenter.V1beta1.Model.RuleViolationInfo.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AlertCenter.V1beta1.Model.RuleViolationInfo do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
